﻿using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using MS.InformationManagement.ContentHub.WebControls;

namespace MS.InformationManagement.ContentHub.CustomFields
{
    public class DocumentTraceabilityField : SPFieldMultiColumn
    {
        public DocumentTraceabilityField(SPFieldCollection fields, string fieldName)
            : base(fields, fieldName){ }

        public DocumentTraceabilityField(SPFieldCollection fields, string typeName, string displayName)
            : base(fields, typeName, displayName) { }

        public override BaseFieldControl FieldRenderingControl
        {
            get
            {
                BaseFieldControl fieldControl =  new DocumentTraceabilityFieldControl();
                fieldControl.FieldName = InternalName;
                return fieldControl;
            }
        }

        public override object GetFieldValue(string value)
        {
            if (string.IsNullOrEmpty(value))
                return null;
            return new DocumentTraceabilityFieldValue(value);
        }
    }
}
